package com.tongjie.hotelbooking.im.conversation.entiry;

import com.tongjie.hotelbooking.im.message.entiry.ImMessage;
import com.tongjie.hotelbooking.user.entity.User;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "hb_member_conversation")
public class MemberConversation implements Serializable {

    private static final long serialVersionUID = -2106833974222224321L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "conversation_id")
    private Conversation conversation;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "member_user_id")
    private User memberUser;

    @Column
    private String memberConversationName;

    @Column
    private Boolean redDot = Boolean.FALSE;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "current_message_id")
    private ImMessage currentMessage;

    @Column(length = 500)
    private String avatar;


}
